import  matplotlib.pyplot as plt
import pandas as pd
# df=pd.read_excel('学生各学期成绩表.xlsx')
# plt.figure(figsize=(12,8))
# x=df['序号']
# plt.subplot(2,2,1)
# plt.plot(x,df['语文'])
# plt.subplot(2,2,2)
# plt.plot(x,df['数学'])
# plt.subplot(2,2,3)
# plt.plot(x,df['英语'])
# plt.subplot(2,2,4)
# plt.plot(x,df['综合'])
# plt.show()


#设置坐标轴刻度
import matplotlib.pyplot as plt
import pandas as pd
df=pd.read_excel('学生各学期成绩表.xlsx')
plt.figure(figsize=(10,8))
x=df['序号']
y=df['语文']
plt.rcParams['font.sans-serif']='SimHei'
plt.title('学生各科成绩分析')
plt.xlabel('学期')
plt.ylabel('成绩')
for a,b in zip(df['序号'],df['语文']):
    plt.text(a,b,'%.1f'%b,ha='center')
plt.grid(axis='y')
plt.xticks(range(11),df['学期'],rotation=15)
plt.plot(x,y)
plt.legend(('语文',))
plt.show()



import matplotlib.pyplot as plt
import  pandas as pd
df=pd.read_excel('学生各学期成绩表.xlsx')
plt.rcParams['figure.figsize']=(10,6)
plt.rcParams['font.sans-serif']='SimHei'
plt.rcParams['xtick.direction']='in'
plt.rcParams['ytick.direction']='in'
plt.title('学生各科成绩分析')
plt.xlabel('学期')
plt.ylabel('成绩')
plt.xticks(rotation=15)
plt.grid()
x=df['学期']
plt.plot(x,df['语文'],'--^')
plt.plot(x,df['数学'],'-.o')
plt.plot(x,df['英语'],'r:d')
plt.legend(['语文','数学','英语'])
plt.show()